package com.chaoxing.ai.testdemo.controller;

import com.chaoxing.ai.testdemo.feign.Feign1Service;
import com.chaoxing.ai.testdemo.feign.FeignService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;

@RestController
@CrossOrigin
@RequestMapping("/ai/demo")
public class TestDemoController {

    @Resource
    private FeignService feignService;
    @Resource
    private Feign1Service feign1Service;

    @RequestMapping(value = "/test1",method = RequestMethod.POST)
    public String test(@RequestParam("file") MultipartFile multipartFile) throws IOException {

        String recognition = feignService.recognition(multipartFile);
        return recognition;
    }
    @RequestMapping(value = "/test2",method = RequestMethod.POST)
    public String test2(@RequestParam("words") String words){
        String s = feign1Service.SpeechSynthesis(words);
        return s;
    }

}
